package com.uphone.kingmall.fragment;

import android.os.Bundle;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.lzy.okgo.model.HttpParams;
import com.uphone.kingmall.activity.HaggleDetailActivity;
import com.uphone.kingmall.adapter.HaggleListAdapter;
import com.uphone.kingmall.base.BaseListFragment;
import com.uphone.kingmall.bean.HaggleListBean;
import com.uphone.kingmall.utils.CommonUtil;
import com.uphone.kingmall.utils.ConstansUtils;
import com.uphone.kingmall.utils.intent.IntentData;

/**
 * <pre>
 *     author : radish
 *     e-mail : 15703379121@163.com
 *     time   : 2019/3/19
 *     desc   :
 * </pre>
 */
public class MineHaggleFragment extends BaseListFragment<HaggleListBean, HaggleListBean.DataBean> {
    @IntentData
    String url;

    public static MineHaggleFragment newInstance(String url) {
        Bundle args = new Bundle();
        args.putString(ConstansUtils.URL, url);
        MineHaggleFragment fragment = new MineHaggleFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    protected HaggleListBean getBeans() {
        return new HaggleListBean();
    }

    @Override
    protected HttpParams getParams() {
        HttpParams params = new HttpParams();
        params.put("page", page);
        params.put("limit", "10");
        return params;
    }

    @Override
    protected String getUrl() {
        return url;
    }

    @Override
    protected void itemClick(BaseQuickAdapter adapter, View view, int position) {
        CommonUtil.startIntent(getActivity(), HaggleDetailActivity.class, dataList.get(position).getHaggleId());
    }

    @Override
    protected BaseQuickAdapter initAdapter() {
        return new HaggleListAdapter();
    }

    @Override
    public void initView(View view) {
    }
}
